package com.zhangwei.day40share;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.onekeyshare.OnekeyShare;
import cn.sharesdk.sina.weibo.SinaWeibo;
import cn.sharesdk.tencent.qq.QQ;

/**
 * shareSdk的使用步骤
 * 1> mob.com 注册账号-->> 注册应用--> appkey跟AppSecret
 * 2> 下载呆毛-->>导入jar包到app
 * 3> 配置manifest文件
 * 3.1>添加权限
 * 3.2>注册sharesdk组件
 * 3.3>在main/assets复制smaple里面sharesdk.xml
 * 修改成在mob.com网站注册的应用生成的key
 * <ShareSDK
 * AppKey = "b6dd6d4345ea"/>
 * 4>去需要分享的第三方平台 注册账号--->>注册应用--生成Appkey跟APPID或者AppSecret====比如新浪微博  腾讯
 * 5>复制生成appkey 和 AppSecret(appID)到main/assets下的sharesdk.xml
 * 6开发
 */

public class MainActivity extends ActionBarActivity implements View.OnClickListener {

    private Button shareBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        shareBtn = (Button) findViewById(R.id.share_btn);
        ShareSDK.initSDK(getApplicationContext());
        shareBtn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        showShare();
    }

    public void showShare() {
        OnekeyShare oks = new OnekeyShare();
        oks.disableSSOWhenAuthorize();
        oks.setText("呵呵,测试分享");
        oks.setComment("好简单啊!!!!");
        oks.show(this);
    }

    public void shareQQ() {
        Platform  qq = ShareSDK.getPlatform(QQ.NAME);
        QQ.ShareParams shareParams = new QQ.ShareParams();
        qq.share(shareParams);
    }
    public void shareSina() {
        Platform  qq = ShareSDK.getPlatform(SinaWeibo.NAME);
        SinaWeibo.ShareParams params = new SinaWeibo.ShareParams();

    }

}
